// var i;
// var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var AL_GAME_HUA_PlayerInfo = require("./AL_GAME_HUA_PlayerInfo");
// var p = cc._decorator;
// var f = p.ccclass;
// var d = p.property;
// var h =
//     (p.menu,
//     (function (e) {
//         function t() {
//             var t = (null !== e && e.apply(this, arguments)) || this;
//             t.loading = null;
//             t.rankPanel = null;
//             return t;
//         }
//         __extends(t, e);
//         t.prototype.onLoad = function () {
//             cc.tween(this.loading)
//                 .by(3, {
//                     angle: 360
//                 })
//                 .repeatForever()
//                 .start();
//             AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().tijiao_dengji_dao_shijie_paihangbang();
//             this.rankPanel ? (this.loading.active = !1) : (this.loading.active = !0);
//         };
//         t.prototype.jiazai_mianban = function () {
//             return __awaiter(this, void 0, void 0, function () {
//                 var e;
//                 return __generator(this, function (t) {
//                     switch (t.label) {
//                         case 0:
//                             return this.rankPanel
//                                 ? ((this.loading.active = !1), this.rankPanel.refresh(), [2])
//                                 : [4, AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_paihangbang_mianban()];
//                         case 1:
//                             if ((e = t.sent())) {
//                                 this.node.addChild(e);
//                                 this.rankPanel = e.getComponent("AL_GAME_HUA_RankPanel");
//                                 this.loading.active = !1;
//                             }
//                             return [2];
//                     }
//                 });
//             });
//         };
//         __decorate([d(cc.Node)], t.prototype, "loading", void 0);
//         return __decorate([f], t);
//     })(cc.Component));
// exports.default = h;


const AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
const AL_GAME_HUA_PlayerInfo = require("./AL_GAME_HUA_PlayerInfo");
const { ccclass, property, menu } = cc._decorator;

/**
 * @class GameClass
 * @extends {cc.Component}
 * @classdesc 这是一个游戏类，负责处理加载和显示排名面板的逻辑。
 */
@ccclass
class GameClass extends cc.Component {
    /** @type {cc.Node} loading - 正在加载中的节点 */
    @property(cc.Node)
    loading = null;

    /** @type {cc.Component} rankPanel - 排名面板组件 */
    rankPanel = null;

    /**
     * 当组件加载时调用
     */
    onLoad() {
        // cc.tween(this.loading)
        //     .by(3, { angle: 360 })
        //     .repeatForever()
        //     .start();

        // AL_GAME_HUA_PlayerInfo.PlayerInfo.getInstance().tijiao_dengji_dao_shijie_paihangbang();
        // this.loading.active = !this.rankPanel;
    }

    /**
     * 异步加载排名面板
     * @returns {Promise<void>}
     */
    async jiazai_mianban() {
        if (this.rankPanel) {
            this.loading.active = false;
            this.rankPanel.refresh();
            return;
        }

        const rankPanel = await AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_paihangbang_mianban();
        if (rankPanel) {
            this.node.addChild(rankPanel);
            this.rankPanel = rankPanel.getComponent("AL_GAME_HUA_RankPanel");
            this.loading.active = false;
        }
    }
}

exports.default = GameClass;
